<!--老师月报评分-->
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>老师端批改月报</title>
		<script src="../../script/mui.min.js"></script>
		<script src="../../script/jquery.min.js" type="text/javascript"></script>
		<script src="../../script/timecontrol.min.js"></script>
		<script src="../../script/common.js"></script>
		<link rel="stylesheet" href="../../css/mui.min.css" />
		<link rel="stylesheet" href="../../css/timecontrol.min.css" />
		<!--<link rel="stylesheet" href="../../css/CFNetPP_Base.css">-->
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/weui.min.css">
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
	</head>
	<body>
		<div class="base_style_color " id='BarAppearance' style="height: 22px;width: 100%"></div>
		<div class="base_navigation_bar base_style_color base_navigation_item_bar">
			<a class="base_left_item" href="#" onclick="showAlert()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span>月报评分</span>
			<a class="base_right_item base_hide_item" href="#"> </a>
		</div>
		<div class=" writeReport" style="margin-top: 66px">
			<!--<div data-role="fieldcontain" class="timecontrol bgwhite" id="">
			<span class="font16 base_dark_grey left_15">时间</span>
			<input type="text" id="time" class="timeipt right" />
			</div>-->
			<div class="bgwhite top_10" >
				<p class="title titlepos">
					老师的评语
				</p>
				<div class="textare_div">
					<textarea class="textarea_t bottom_10" id="comment" placeholder='字数不得少于5个字'></textarea>
				</div>
			</div>
			<div class="myScore top_10" id="lspf">
				<p class="title">
					老师的评分
				</p>
				<div class="myScore-starscore clearfix top_15">
					<div class="letter left">
						实习态度：
					</div>
					<div class="star left" id="taiduNum">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png" hidden="hidden">
					</div>
				</div>
				<div class="myScore-starscore clearfix top">
					<div class="letter left">
						出勤率：
					</div>
					<div class="star left" id="chuqinNum">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png" hidden="hidden">
					</div>
				</div>
				<div class="myScore-starscore clearfix top">
					<div class="letter left">
						工作完成度：
					</div>
					<div class="star left" id="gzwcdNum">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png" hidden="hidden">
					</div>
				</div>
				<div class="myScore-starscore clearfix top">
					<div class="letter left">
						技能掌握度：
					</div>
					<div class="star left" id="jnzwdNum">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png">
						<img src="../../image/icon_xingxing01.png" hidden="hidden">
					</div>
				</div>
			</div>
			<button id="sumbit_bt" type="button" class=" top_30 bottom_30 mui-btn-warning horcenter btn_submit " onclick="sumbit()">
				提交
			</button>
		</div>
		<div id="offlineAlert" class="weui_dialog_confirm" style="display: none;">
			<div class="weui_mask"></div>
			<div class="weui_dialog">
				<div class="weui_dialog_hd">
					<strong class="weui_dialog_title">是否放弃在此页面操作？</strong>
				</div>
				<div class="weui_dialog_bd"></div>
				<div class="weui_dialog_ft">
					<a onclick="cleanCancel()" href="#" class="weui_btn_dialog default"  style="color:#18b4ed">取消</a>
					<a onclick="cleanConfirm()" href="#" class="weui_btn_dialog primary"  style="color:#18b4ed">确定</a>
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/base64.min.js"></script>
	<script type="text/javascript">
		var sxtdScore = 0;
		var cqlScore = 0;
		var gzwcdScore = 0;
		var jnzwdScore = 0;
		var comment = '';
		var parten = /^\s*$/;
		var stuid = '';
		var id = '';
		var apiready = function() {
			SendBehaviorTrajectoriesNotifi1('0', '老师端批改月报', '109', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			var pageParam = api.pageParam;
			stuid = pageParam.stuid;
			var pageParam = api.pageParam;
			id = pageParam.id;
			setupStarClick();
			backKey();
		}
		function sumbit() {
			//			SendBehaviorTrajectoriesNotifi('1', '老师端批改月报', '109');
			var com = $('#comment').val();
			var param = {
				lsid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjid'),
				uid : $api.getStorage('cfnetppuid'),
				ybid : id,
				stuid : stuid,
				comments : Base64.encode(com),
//              comments:com,
				tsxtd : sxtdScore, //实习态度(返回分值最高10分)
				tcql : cqlScore, //出勤率
				tgzwcd : gzwcdScore, //工作完成度
				tjnzwd : jnzwdScore, //技能掌握
				message : api.pageParam.studentname + '的月报'
			};
			if (com.length == 0 || com == null || parten.test(com)) {
				ShowToast('提交信息不完整，请完善信息后再次提交');
			} else if (com.length < 5) {
				ShowToast('评语的长度不能小于5个字符');
			} else if (sxtdScore == 0 || cqlScore == 0 || gzwcdScore == 0 || jnzwdScore == 0) {
				ShowToast('你还未评分完成，请评分');
			} else {
				//							alert('获取数据' + JSON.stringify(param));
				showProgress();
				cfnetppPOST(urlLspjmonth, param, false, function(data, status) {
					hideProgress();
					SendBusinessOperationsLogNotifi('老师端批改月报', '109', param, param, '', data, '老师端批改月报接口', '109-01')
					if (status == 'success') {
						hideProgress();
						if (data.status == 1) {
							api.toast({
								msg : '评价成功',
								duration : 1000,
								location : 'bottom'
							});
							sendNotifi();
							setTimeout(function() {
								next();
							}, 200);
						} else {
							ShowToast('提交失败，请重试');
						}
					} else {
						ShowToast('提交失败，请重试');
					}
				});
			}
		}

		function backKey() {
			api.addEventListener({
				name : 'keyback'
			}, function(ret, err) {
				showAlert();
			});
		}

		function showAlert() {
			//			SendBehaviorTrajectoriesNotifi('1', '老师端批改月报', '109');
			comment = $('#comment').val();
			if (comment.length > 0) {
				$('#offlineAlert').show();
			} else {
				backClick();
			}
		}

		function cleanCancel() {
			$('#offlineAlert').hide();
		}

		function backClick() {
			SendBehaviorTrajectoriesNotifi1('1', '老师端批改月报', '109', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			api.closeWin({
			});
		}

		//确定
		function cleanConfirm() {
			$('#offlineAlert').hide();
			backClick();
		}

		//        跳转月报已审核列表页面
		function next() {
			SendBehaviorTrajectoriesNotifi1('1', '老师端批改月报', '109', api.pageParam.sourceurl, api.pageParam.sourcetitle, window.location.pathname, document.title);
			api.closeToWin({
				name : 'Teacher_MonthWindow'
			});
		}

		function sendNotifi() {
			api.sendEvent({
				name : 'RefreshReviewedMonthNotifi'
			});
		}

		function setupStarClick() {
			$('.star img').each(function(i) {
				$(this).click(function() {
					$(this).attr('src', '../../image/icon_xingxing.png');
					$(this).prevAll().attr('src', '../../image/icon_xingxing.png');
					$(this).nextAll().attr('src', '../../image/icon_xingxing01.png');
					var score = ($(this).prevAll().length + 1) * 5;
					if ($(this).parent().attr('id') == 'taiduNum') {//实习态度
						sxtdScore = score;
					} else if ($(this).parent().attr('id') == 'chuqinNum') {//出勤率
						cqlScore = score;
					} else if ($(this).parent().attr('id') == 'gzwcdNum') {//工作完成度
						gzwcdScore = score;
					} else if ($(this).parent().attr('id') == 'jnzwdNum') {//技能掌握度
						jnzwdScore = score;
					}
				})
			});
		}
	</script>
</html>